import 'package:fish_redux/fish_redux.dart';

import 'action.dart';
import 'state.dart';

Reducer<ItemComponentState> buildReducer() {
  return asReducer(
    <Object, Reducer<ItemComponentState>>{
      ItemComponentAction.action: _onAction,
      ItemComponentAction.refreshTitle:_refreshTitle
    },
  );
}

ItemComponentState _onAction(ItemComponentState state, Action action) {
  final ItemComponentState newState = state.clone();
  return newState;
}

ItemComponentState _refreshTitle(ItemComponentState state, Action action) {
  final ItemComponentState newState = state.clone();
  newState.clone()..title = 'hahaha';
  print('_refreshTitle'+newState.title);
  return newState;
}
